<!DOCTYPE html>
<html lang="en"><head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="stylesheet" href="/static/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <link rel="stylesheet" href="/static/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
    <link href="/static/css/fonts.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/css/mit_app_inventor.css">
    <script type="text/javascript">
     <!--//--><![CDATA[// ><!--

                                   var gotoappinventor = function() {
                                       var referrer = document.location.pathname;
                                       var patt = /.*hour-of-code.*/;
                                       if (referrer.match(patt)) {
                                           window.open("http://code.appinventor.mit.edu/", "new");
                                       } else {
                                           window.open("http://ai2.appinventor.mit.edu/", "new");
                                       }
                                   }
     //--><!]]>
    </script>
    <title>MIT App Inventor Math Blocks</title></head>
<body class="mit_app_inventor"><nav class="navbar navbar-expand-xl navbar-light">
    <a class="navbar-brand" href="http://appinventor.mit.edu/">
	<img src="/static/images/logo2.png" alt="Logo">
    </a>
    <button type="button" class="btn create-btn" style="margin-right: 20px;" onclick="gotoappinventor();">Create Apps!</button>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarContent"
            aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle Navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarContent">
	<ul class="navbar-nav" style="margin-left: auto;">
	    <li class="nav-item dropdown">
		<a class="nav-link" href="http://appinventor.mit.edu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		    About
		</a>
		<div class="dropdown-menu">
		    <a class="dropdown-item" href="http://appinventor.mit.edu/about-us">About App Inventor</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/our-team">Our Team</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/expert-trainers">Expert Trainers</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/app-month-gallery">App of the Month</a>
                    <a class="dropdown-item"
                       href="http://appinventor.mit.edu/ai2/ReleaseNotes">Release Notes</a>
                    <a class="dropdown-item" href="http://appinventor.mit.edu/about/termsofservice" target="_blank">Terms of Service</a>
		</div>
	    </li>
	    <li class="nav-item dropdown">
		<a class="nav-link" href="http://appinventor.mit.edu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		    Educators
		</a>
		<div class="dropdown-menu">
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/teach" target="_blank">Teach</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/ai2/tutorials">Tutorials</a>
		</div>
	    </li>
	    <li class="nav-item dropdown">
		<a class="nav-link" href="http://appinventor.mit.edu/news" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		    News
		</a>
		<div class="dropdown-menu">
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/news">In the news</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/events">Events</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/stories">Stories from the field</a>
		</div>
	    </li>
	    <li class="nav-item dropdown">
		<a class="nav-link" href="http://appinventor.mit.edu/explore/resources" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		    Resources
		</a>
		<div class="dropdown-menu">
                    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/get-started">Get Started</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/library">Documentation</a>
		    <a class="dropdown-item" href="https://community.appinventor.mit.edu"
                       target="_blank">Forums</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/ai2/tutorials">Tutorials</a>
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/books">App Inventor Books</a>
		    <a class="dropdown-item"
                       href="https://github.com/mit-cml/appinventor-sources"
                       target="_blank">Open Source Information</a>
	            <a class="dropdown-item" href="http://appinventor.mit.edu/explore/research">Research</a>
                    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/hour-of-code">Hour of Code</a>
                    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/resources">Additional Resources</a>
		</div>
	    </li>
            <li class="nav-item dropdown">
		<a class="nav-link" href="http://appinventor.mit.edu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		    Blogs
		</a>
                <div class="dropdown-menu">
		    <a class="dropdown-item" href="http://appinventor.mit.edu/explore/blog">App Inventor Blog</a>
	        </div>
            </li>
        </ul>
        <div style="display: inline-flex;margin-left:auto;margin-right:0">
	    <a href="https://giving.mit.edu/give/to?fundId=3832320" target="_blank">
                <button type="button" class="btn donate-btn" style="margin-right: 20px;">Donate</button></a>
            <script>
             (function() {
                 var cx = '005719495929270354943:tlvxrelje-e';
                 var gcse = document.createElement('script');
                 gcse.type = 'text/javascript';
                 gcse.async = true;
                 gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
                            '//www.google.com/cse/cse.js?cx=' + cx;
                 var s = document.getElementsByTagName('script')[0];
                 s.parentNode.insertBefore(gcse, s);
             })();
            </script>
            <gcse:searchbox-only></gcse:searchbox-only>
        </div>
	<!-- <form class="form-inline" action="/action_page.php">
	     <div class="form-group has-search">
	     <span class="fa fa-search form-control-feedback"></span>
	     <input type="text" class="form-control" placeholder="Search">
	     </div>
	     </form> -->
    </div>
</nav>
<div class="default-page">
            <div class="header">
	        <h1 class="font-weight-bold text-center offset-xl-2 col-xl-8">MIT App Inventor Math Blocks</h1>
            </div>
            <div class="container-fluid">
                <article class="documentation">
<ul>
  <li><a href="#number">0 (basic number block)</a></li>
  <li><a href="#number-radix">0 (radix number block)</a></li>
  <li><a href="#=">=</a></li>
  <li><a href="#not=">≠</a></li>
  <li><a href="#gt">&gt;</a></li>
  <li><a href="#gte">≥</a></li>
  <li><a href="#lt">&lt;</a></li>
  <li><a href="#lte">≤</a></li>
  <li><a href="#add">+</a></li>
  <li><a href="#subtract">-</a></li>
  <li><a href="#multiply">*</a></li>
  <li><a href="#divide">/</a></li>
  <li>[^](#exponent)</li>
  <li><a href="#randomint">random integer</a></li>
  <li><a href="#randomfrac">random fraction</a></li>
  <li><a href="#randomseed">random set seed to</a></li>
  <li><a href="#min">min</a></li>
  <li><a href="#max">max</a></li>
  <li><a href="#sqrt">square root</a></li>
  <li><a href="#abs">abs</a></li>
  <li><a href="#neg">neg</a></li>
  <li><a href="#log">log</a></li>
  <li><a href="#e">e^</a></li>
  <li><a href="#round">round</a></li>
  <li><a href="#ceiling">ceiling</a></li>
  <li><a href="#floor">floor</a></li>
  <li><a href="#modulo">modulo</a></li>
  <li><a href="#remainder">remainder</a></li>
  <li><a href="#quotient">quotient</a></li>
  <li><a href="#sin">sin</a></li>
  <li><a href="#cos">cos</a></li>
  <li><a href="#tan">tan</a></li>
  <li><a href="#asin">asin</a></li>
  <li><a href="#acos">acos</a></li>
  <li><a href="#atan">atan</a></li>
  <li><a href="#atan2">atan2</a></li>
  <li><a href="#convertrad">convert radians to degrees</a></li>
  <li><a href="#convertdeg">convert degrees to radians</a></li>
  <li><a href="#format">format as a decimal</a></li>
  <li><a href="#isnumber">is a number</a></li>
  <li><a href="#convertnumber">convert number</a></li>
  <li><a href="#bitwise_and">bitwise and</a></li>
  <li><a href="#bitwise_ior">bitwise or (inclusive)</a></li>
  <li><a href="#bitwise_xor">bitwise or (exclusive)</a></li>
  <li><a href="#avg">average</a></li>
  <li><a href="#minl">list min</a></li>
  <li><a href="#maxl">list max</a></li>
  <li><a href="#mode">mode</a></li>
  <li><a href="#gm">geometric mean</a></li>
  <li><a href="#sd">standard deviation</a></li>
  <li><a href="#se">standard error</a></li>
</ul>

<p><em>Can’t find the math block you’re looking for in the built-in blocks?</em></p>

<p>Some math blocks are dropdowns which means that they can be converted into different blocks. Here’s a list of what is included in each dropdown.</p>

<p>=, ≠, &gt;, ≥, &lt;, ≤</p>

<p><img src="images/math/equals.gif" alt="" /></p>

<p>min, max</p>

<p><img src="images/math/minmax.gif" alt="" /></p>

<p>sqrt, abs, -, log, e^, round, ceiling, floor</p>

<p><img src="images/math/sqrt.gif" alt="" /></p>

<p>modulo of, remainder of, quotient of</p>

<p><img src="images/math/modulo.gif" alt="" /></p>

<p>sin, cos, tan, asin, acos, atan</p>

<p><img src="images/math/sin.gif" alt="" /></p>

<p>convert radians to degrees, convert degrees to radians</p>

<p><img src="images/math/convert.gif" alt="" /></p>

<h3 id="number">Basic Number Block</h3>

<p><img src="images/math/number.png" alt="" /></p>

<p>Can be used as any positive or negative number. Clicking on the “0” in the block will allow you to change the number.</p>

<p>The block supports normal base-10 numbers (for example: 2, 12, and 2.12), as well as C-like prefixes for other number bases. It supports:</p>
<ul>
  <li>Base-2 (binary) numbers, e.g. 0b10 (decimal 2)</li>
  <li>Base-8 (octal) numbers, e.g. 0o14 (decimal 12)</li>
  <li>Base-16 (hexadecimal) numbers, e.g. 0xd4 (decimal 212)</li>
</ul>

<h3 id="number-radix">Radix Number Block</h3>

<p><img src="images/math/numberradix.png" alt="" /></p>

<p>Represents a base-10 number. Clicking on the “0” will allow you to change the number.</p>

<p>Clicking the dropdown will allow you to input a number in a different number base (aka radix). The number will then be “translated” into decimal (aka base-10).</p>

<p>For example, these three blocks are equivalent:</p>

<p><img src="images/math/numberradix_equivalent.png" alt="" /></p>

<p>The dropdown supports: decimal (base-10), binary (base-2), octal (base-8), and hexadecimal (base-16) input formats.</p>

<p>Decimal mode allows you to input any positive or negative number (e.g. 2, -12, 2.12). The other modes only allow you to input a whole number (aka any positive number, or zero).</p>

<h3 id="---">=   {#=}</h3>

<p><img src="images/math/equal.png" alt="" /></p>

<p>Tests whether two numbers are equal and returns true or false.</p>

<h3 id="---not">≠   {#not=}</h3>

<p><img src="images/math/notequal.png" alt="" /></p>

<p>Tests whether two numbers are not equal and returns true or false.</p>

<h3 id="gt">&gt;</h3>

<p><img src="images/math/greater.png" alt="" /></p>

<p>Tests whether the first number is greater than the second number and returns true or false.</p>

<h3 id="gte">≥</h3>

<p><img src="images/math/greaterequal.png" alt="" /></p>

<p>Tests whether the first number is greater than or equal to the second number and returns true or false.</p>

<h3 id="lt">&lt;</h3>

<p><img src="images/math/less.png" alt="" /></p>

<p>Tests whether the first number is less than the second number and returns true or false.</p>

<h3 id="lte">≤</h3>

<p><img src="images/math/lessequal.png" alt="" /></p>

<p>Tests whether the first number is less than or equal to the second number and returns true or false.</p>

<h3 id="add">+</h3>

<p><img src="images/math/plus.png" alt="" /></p>

<p>Returns the result of adding any amount of blocks that have a number value together. Blocks with a number value include the basic number block, length of list or text, variables with a number value, etc. This block is a <a href="../concepts/mutators.html">mutator</a> and can be expanded to allow more numbers in the sum.</p>

<p><img src="images/math/plus.gif" alt="" /></p>

<h3 id="subtract">-</h3>

<p><img src="images/math/minus.png" alt="" /></p>

<h3 id="multiply">*</h3>

<p><img src="images/math/multiply.png" alt="" /></p>

<p>Returns the result of multiplying any amount of blocks that have a number value together. It is a <a href="../concepts/mutators.html">mutator</a> block and can be expanded to allow more numbers in the product.</p>

<p><img src="images/math/multiply.gif" alt="" /></p>

<h3 id="divide">/</h3>

<p><img src="images/math/divide.png" alt="" /></p>

<p>Returns the result of dividing the first number by the second.</p>

<h3 id="exponent">^</h3>

<p><img src="images/math/exponent.png" alt="" /></p>

<p>Returns the result of the first number raised to the power of the second.</p>

<h3 id="randomint">random integer</h3>

<p><img src="images/math/randomint.png" alt="" /></p>

<p>Returns a random integer value between the given values, inclusive. The order of the arguments doesn’t matter.</p>

<h3 id="randomfrac">random fraction</h3>

<p><img src="images/math/randomfrac.png" alt="" /></p>

<p>Returns a random value between 0 and 1.</p>

<h3 id="randomseed">random set seed to</h3>

<p><img src="images/math/randomseed.png" alt="" /></p>

<p>Use this block to generate repeatable sequences of random numbers. You can generate the same sequence of random numbers by first calling random set seed with the same value. This is useful for testing programs that involve random values.</p>

<h3 id="min">min</h3>

<p><img src="images/math/min.png" alt="" /></p>

<p>Returns the smallest value of a set of numbers. If there are unplugged sockets in the block, min will also consider 0 in its set of numbers. This block is a <a href="../concepts/mutators.html">mutator</a> and a dropdown.</p>

<h3 id="max">max</h3>

<p><img src="images/math/max.png" alt="" /></p>

<p>Returns the largest value of a set of numbers. If there are unplugged sockets in the block, max will also consider 0 in its set of numbers. This block is a <a href="../concepts/mutators.html">mutator</a> and a dropdown.</p>

<h3 id="sqrt">square root</h3>

<p><img src="images/math/sqrt.png" alt="" /></p>

<p>Returns the square root of the given number.</p>

<h3 id="abs">abs</h3>

<p><img src="images/math/abs.png" alt="" /></p>

<p>Returns the absolute value of the given number.</p>

<h3 id="neg">neg</h3>

<p><img src="images/math/neg.png" alt="" /></p>

<p>Returns the negative of a given number.</p>

<h3 id="log">log</h3>

<p><img src="images/math/log.png" alt="" /></p>

<p>Returns the natural logarithm of a given number, that is, the logarithm to the base e (2.71828…).</p>

<h3 id="e">e^</h3>

<p><img src="images/math/e.png" alt="" /></p>

<p>Returns e (2.71828…) raised to the power of the given number.</p>

<h3 id="round">round</h3>

<p><img src="images/math/round.png" alt="" /></p>

<p>Returns the given number rounded to the closest integer. If the fractional part is &lt; .5 it will be rounded down. It it is &gt; .5 it will be rounded up. If it is exactly equal to .5, numbers with an even whole part will be rounded down, and numbers with an odd whole part will be rounded up. (This method is called round to even.)</p>

<h3 id="ceiling">ceiling</h3>

<p><img src="images/math/ceiling.png" alt="" /></p>

<p>Returns the smallest integer that’s greater than or equal to the given number.</p>

<h3 id="floor">floor</h3>

<p><img src="images/math/floor.png" alt="" /></p>

<p>Returns the greatest integer that’s less than or equal to the given number.</p>

<h3 id="modulo">modulo</h3>

<p><img src="images/math/modulo.png" alt="" /></p>

<p>Modulo(a,b) is the same as remainder(a,b) when a and b are positive. More generally, modulo(a,b) is defined for any a and b so that (floor(a/b)× b) + modulo(a,b) = a. For example, modulo(11, 5) = 1, modulo(-11, 5) = 4, modulo(11, -5) = -4, modulo(-11, -5) = -1. Modulo(a,b) always has the same sign as b, while remainder(a,b) always has the same sign as a.</p>

<h3 id="remainder">remainder</h3>

<p><img src="images/math/remainder.png" alt="" /></p>

<p>Remainder(a,b) returns the result of dividing a by b and taking the remainder. The remainder is the fractional part of the result multiplied by b.</p>

<p>For example, remainder(11,5) = 1 because</p>

<p>11 / 5 = 2 <sup>1</sup>⁄<sub>5</sub></p>

<p>In this case, <sup>1</sup>⁄<sub>5</sub> is the fractional part. We multiply this by b, in this case 5 and we get 1, our remainder.</p>

<p>Other examples are remainder(-11, 5) = -1, remainder(11, -5) = 1, and remainder(-11, -5) = -1.</p>

<h3 id="quotient">quotient</h3>

<p><img src="images/math/quotient.png" alt="" /></p>

<p>Returns the result of dividing the first number by the second and discarding any fractional part of the result.</p>

<h3 id="sin">sin</h3>

<p><img src="images/math/sin.png" alt="" /></p>

<p>Returns the sine of the given number in degrees.</p>

<h3 id="cos">cos</h3>

<p><img src="images/math/cos.png" alt="" /></p>

<p>Returns the cosine of the given number in degrees.</p>

<h3 id="tan">tan</h3>

<p><img src="images/math/tan.png" alt="" /></p>

<p>Returns the tangent of the given number in degrees.</p>

<h3 id="asin">asin</h3>

<p><img src="images/math/asin.png" alt="" /></p>

<p>Returns the arcsine of the given number in degrees.</p>

<h3 id="acos">acos</h3>

<p><img src="images/math/acos.png" alt="" /></p>

<p>Returns the arccosine of the given number in degrees.</p>

<h3 id="atan">atan</h3>

<p><img src="images/math/atan.png" alt="" /></p>

<p>Returns the arctangent of the given number in degrees.</p>

<h3 id="atan2">atan2</h3>

<p><img src="images/math/atan2.png" alt="" /></p>

<p>Returns the arctangent of y/x, given y and x.</p>

<h3 id="convertrad">convert radians to degrees</h3>

<p><img src="images/math/convertrad.png" alt="" /></p>

<p>Returns the value in degrees of the given number in radians. The result will be an angle in the range [0, 360)</p>

<h3 id="convertdeg">convert degrees to radians</h3>

<p><img src="images/math/convertdeg.png" alt="" /></p>

<p>Returns the value in radians of the given number in degrees. The result will be an angle in the range [-π , +π)</p>

<h3 id="format">format as decimal</h3>

<p><img src="images/math/format.png" alt="" /></p>

<p>Formats a number as a decimal with a given number of places after the decimal point. The number of places must be a non-negative integer. The result is produced by rounding the number (if there were too many places) or by adding zeros on the right (if there were too few).</p>

<h3 id="isnumber">is a number?</h3>

<p><img src="images/math/isnumber.png" alt="" /></p>

<p>Returns true if the given object is a number, and false otherwise.</p>

<h3 id="convertnumber">convert number</h3>

<p><img src="images/math/convertnumber.png" alt="" /></p>

<p>Takes a text string that represents a positive integer in one base and returns a string that represents the same number is another base. For example, if the input string is 10, then converting from base 10 to binary will produce the string 1010; while if the input string is the same 10, then converting from binary to base 10 will produce the string 2. If the input string is the same 10, then converting from base 10 to hex will produce the string A.</p>

<h3 id="bitwise_and">Bitwise And</h3>

<p><img src="images/math/bitwise_and.png" alt="" /></p>

<p>Takes two numbers and compares each pair of bits. Each bit of the result is 1 only if the corresponding bits of both operands are 1.</p>

<p>Example:</p>

<table>
  <thead>
    <tr>
      <th> </th>
      <th>Decimal</th>
      <th>Binary (internal representation)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td> </td>
      <td>6</td>
      <td>0 1 1 0</td>
    </tr>
    <tr>
      <td> </td>
      <td>3</td>
      <td>0 0 1 1</td>
    </tr>
    <tr>
      <td>Result:</td>
      <td>2</td>
      <td>0 0 1 0</td>
    </tr>
  </tbody>
</table>

<h3 id="bitwise_ior">Bitwise Or (Inclusive)</h3>

<p><img src="images/math/bitwise_ior.png" alt="" /></p>

<p>Takes two numbers and compares each pair of bits. Each bit of the result is 1 if either of the corresponding bits in each operand is 1.</p>

<p>Example:</p>

<table>
  <thead>
    <tr>
      <th> </th>
      <th>Decimal</th>
      <th>Binary (internal representation)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td> </td>
      <td>6</td>
      <td>0 1 1 0</td>
    </tr>
    <tr>
      <td> </td>
      <td>3</td>
      <td>0 0 1 1</td>
    </tr>
    <tr>
      <td>Result:</td>
      <td>7</td>
      <td>0 1 1 1</td>
    </tr>
  </tbody>
</table>

<h3 id="bitwise_xor">bitwise Or (Exclusive)</h3>

<p><img src="images/math/bitwise_xor.png" alt="" /></p>

<p>Takes two numbers and compares each pair of bits. Each bit of the result is 1 only if one corresponding bit in the operands is 1 and the other is 0.</p>

<p>Example:</p>

<table>
  <thead>
    <tr>
      <th> </th>
      <th>Decimal</th>
      <th>Binary (internal representation)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td> </td>
      <td>6</td>
      <td>0 1 1 0</td>
    </tr>
    <tr>
      <td> </td>
      <td>3</td>
      <td>0 0 1 1</td>
    </tr>
    <tr>
      <td>Result:</td>
      <td>5</td>
      <td>0 1 0 1</td>
    </tr>
  </tbody>
</table>

<p><img src="images/math/avg.png" alt="" /></p>

<p>Calculates the arithmetic mean of the elements in a list.</p>

<p><img src="images/math/minl.png" alt="" /></p>

<p>Returns the minimum element in a list.</p>

<p><img src="images/math/maxl.png" alt="" /></p>

<p>Returns the maximum element in a list.</p>

<p><img src="images/math/mode.png" alt="" /></p>

<p>Returns the most frequent element in a list.</p>

<p><img src="images/math/gm.png" alt="" /></p>

<p>Calculates the geometric mean of the elements in a list.</p>

<p><img src="images/math/sd.png" alt="" /></p>

<p>Calculates the (population) standard deviations of the elements in a list.</p>

<p><img src="images/math/se.png" alt="" /></p>

<p>Calculates the standard error of the elements in a list.</p>

</article>
<script>
  // Handle redirection to documentation based on locale query parameter (if specified)
  (function() {
      var locale = window.location.search.match('[&?]locale=([a-zA-Z-]*)');
      if (locale) {
          if (locale[1].indexOf('en') === 0) {
              // English needs to stay at the top level to not break existing links
              var page = window.location.pathname.split('/');
              if (page.length === 5) {
                  page.splice(2, 1);
              } else {
                  // already on english
                  return;
              }
              window.location.href = page.join('/');
          } else {
              var page = window.location.pathname.split('/');
              if (page.length === 4) {
                  page.splice(2, 0, locale[1]);
              } else if (page[2].toLowerCase() != locale[1].toLowerCase()) {
                  page[2] = locale[1];
              } else {
                  return;  // already on the desired language
              }
              // Test that the page exists before redirecting.
              var xhr = new XMLHttpRequest();
              xhr.open('HEAD', page.join('/'), false);
              xhr.onreadystatechange = function() {
                  if (xhr.readyState == 4) {
                      if ((xhr.status == 200 || xhr.status == 204)) {
                          window.location.href = page.join('/');
                      } else if (xhr.status  >= 400) {
                          page.splice(2, 1);  // go to english version
                          window.location.href = page.join('/');
                      }
                  }
              };
              xhr.send();
          }
      }
  })();

  // Handle embedded documentation in help by removing website template
  if (window.self !== window.top) {
      setTimeout(function() {
          var videos = document.querySelectorAll('video');
          for (var i = 0; i < videos.length; i++) {
              if (parseInt(videos[i].getAttribute('width')) > 360) {
                  var aspect = parseInt(videos[i].getAttribute('height')) / parseInt(videos[i].getAttribute('width'));
                  videos[i].setAttribute('width', '360');
                  videos[i].setAttribute('height', '' + (360 * aspect));
              }
          }
          var h1 = document.querySelector('h1');
          var article = document.querySelector('article');
          article.insertBefore(h1, article.firstElementChild);
          document.body.innerHTML = article.outerHTML;
      });
  }
</script>

            </div>
            <div class="footer background-green">
    <div class="row container">
	<div class="col-xl-3">
	    <h3>MIT App Inventor</h3>
	    <!-- <form class="form-inline" action="/action_page.php">
		 <div class="form-group has-search">
		 <span class="fa fa-search form-control-feedback"></span>
		 <input type="text" class="form-control" placeholder="Search">
		 </div>
		 </form> -->
	</div>
	<div class="col-xl-6 legal text-center">
	    <ul>
		<li>
		    <a href="http://web.mit.edu" class="btn btn-link" role="button"
                       target="_blank">© 2012-2024 Massachusetts Institute of Technology</a>
		</li>
		<li>
		    <a href="http://creativecommons.org/licenses/by-sa/3.0/"
                       target="_blank" class="btn btn-link" role="button">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0</a>
		</li>
		<li>
		    <a href="http://appinventor.mit.edu/about/termsofservice"
                       target="_blank" class="btn btn-link" role="button">Terms of Service and Privacy Policy</a>
		</li>
	    </ul>
	</div>
	<div class="col-xl-3 links">
            <a href="https://community.appinventor.mit.edu" target="_blank">Support / Help</a><br>
            <a href="mailto:appinventor@mit.edu">Other Inquiries</a>
	    <div>
		<span>Twitter:</span>
		<a href="https://twitter.com/mitappinventor"
                   target="_blank" class="btn btn-link" role="button">@MITAppInventor</a>
	    </div>
	    <div>
	      <span>GitHub:</span>
	      <a href="https://github.com/mit-cml" class="btn btn-link" role="button"
                 target="_blank">mit-cml</a>
	    </div>
            <div>
              <span>Accessibility:</span>
              <a href="https://accessibility.mit.edu" role="button"
                 targe="_blank">accessibility.mit.edu</a>
            </div>
        </div>
    </div>
</div>
<script src="/static/js/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="/static/js/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="/static/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script async src="/static/js/widgets.js" charset="utf-8"></script>
</div>
    </body>
</html>
